<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>{% block title %}乳腺癌预测系统{% endblock %}</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700&display=swap" rel="stylesheet">
    <!-- 自定义 CSS -->
    <link rel="stylesheet" href="{{ url_for('static', filename='css/styles.css') }}">
    {% block extra_css %}{% endblock %}
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
        <div class="container">
            <a class="navbar-brand d-flex align-items-center" href="/">
                <img src="{{ url_for('static', filename='images/logo.png') }}" alt="Logo" height="40" class="me-2">
                <span>乳腺癌预测系统</span>
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link {% if request.path == '/' %}active{% endif %}" href="/">首页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link {% if request.path == '/predict-form' %}active{% endif %}" href="/predict-form">开始预测</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link {% if request.path == '/params-info' %}active{% endif %}" href="/params-info">参数解释</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link {% if request.path == '/about' %}active{% endif %}" href="/about">关于项目</a>
                    </li>
                </ul>

                <!-- 用户登录状态 -->
                <ul class="navbar-nav">
                    {% if session.user_id %}
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                                <i class="fas fa-user me-1"></i> {{ session.username }}
                            </a>
                            <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                                <li><a class="dropdown-item" href="/profile"><i class="fas fa-user-cog me-2"></i> 个人资料</a></li>
                                <li><a class="dropdown-item" href="/history"><i class="fas fa-history me-2"></i> 预测历史</a></li>
                                <li><hr class="dropdown-divider"></li>
                                <li><a class="dropdown-item" href="/logout"><i class="fas fa-sign-out-alt me-2"></i> 退出登录</a></li>
                            </ul>
                        </li>
                    {% else %}
                        <li class="nav-item">
                            <a class="nav-link {% if request.path == '/login' %}active{% endif %}" href="/login">
                                <i class="fas fa-sign-in-alt me-1"></i> 登录
                            </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link {% if request.path == '/register' %}active{% endif %}" href="/register">
                                <i class="fas fa-user-plus me-1"></i> 注册
                            </a>
                        </li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

    <!-- 主要内容 -->
    <main class="py-4">
        <!-- Flash消息显示 -->
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                <div class="container">
                    {% for category, message in messages %}
                        <div class="alert alert-{{ 'danger' if category == 'error' else ('warning' if category == 'warning' else ('success' if category == 'success' else 'info')) }} alert-dismissible fade show" role="alert">
                            {% if category == 'error' %}
                                <i class="fas fa-exclamation-triangle me-2"></i>
                            {% elif category == 'warning' %}
                                <i class="fas fa-exclamation-circle me-2"></i>
                            {% elif category == 'success' %}
                                <i class="fas fa-check-circle me-2"></i>
                            {% else %}
                                <i class="fas fa-info-circle me-2"></i>
                            {% endif %}
                            {{ message }}
                            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                        </div>
                    {% endfor %}
                </div>
            {% endif %}
        {% endwith %}

        {% block content %}{% endblock %}
    </main>

    <!-- 页脚 -->
    <footer class="bg-dark text-white py-4 mt-5">
        <div class="container">
            <div class="row">
                <div class="col-md-6">
                    <h5>乳腺癌预测系统</h5>
                    <p>利用机器学习技术，准确预测乳腺肿瘤的良恶性，准确率超过95%。</p>
                </div>
                <div class="col-md-3">
                    <h5>链接</h5>
                    <ul class="list-unstyled">
                        <li><a href="/" class="text-white">首页</a></li>
                        <li><a href="/predict-form" class="text-white">开始预测</a></li>
                        <li><a href="/params-info" class="text-white">参数解释</a></li>
                        <li><a href="/about" class="text-white">关于项目</a></li>
                    </ul>
                </div>
                <div class="col-md-3">
                    <h5>资源</h5>
                    <ul class="list-unstyled">
                        <li><a href="https://www.cancer.org/cancer/breast-cancer.html" class="text-white" target="_blank">美国癌症协会</a></li>
                        <li><a href="https://www.breastcancer.org/" class="text-white" target="_blank">乳腺癌组织</a></li>
                    </ul>
                </div>
            </div>
            <hr>
            <div class="row">
                <div class="col-md-12 text-center">
                    <p>© 2025 乳腺癌预测系统 | 原项目由 Sri Manikanta 开发 | 界面升级版</p>
                </div>
            </div>
        </div>
    </footer>

    <!-- 回到顶部按钮 -->
    <a id="back-to-top" href="#" class="btn btn-primary btn-lg back-to-top" role="button">
        <i class="fas fa-chevron-up"></i>
    </a>

    <!-- Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <!-- jQuery -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <!-- Chart.js -->
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <!-- 自定义 JS -->
    <script src="{{ url_for('static', filename='js/main.js') }}"></script>
    {% block extra_js %}{% endblock %}



</body>
</html>